/**
 * @file 路由重定向
 * @date 2025/10/24 12:45:55
 * @author lyqjob@yeah.net
 */

import {  useEffect  } from 'react';
import { useNavigate ,useLocation} from "react-router-dom";

export default function NoMatch() {
    const navigate = useNavigate();
    const location = useLocation();
    
    useEffect(() => {
        const previousPath = location.state?.from || sessionStorage.getItem("lastValidPath") || '/'; // 需要确保在导航时传递了 stat
        navigate(previousPath, { replace: true }); // 或者其他默认行为
        
    }, []);

    return null
}